package glb;

import org.junit.Test; 
import robocode.ScannedRobotEvent;
import static org.junit.Assert.*;
/**
 * Tests that Failbot's getPow() method functions correctly.
 * This method is used to determine a bullet's power.
 * @author Gregory Burgess
 *
 */
public class TestFire { 

  /**
   * Test Failbot's getPow() method by handing it specifically parameterized events.
   */
  @Test
  public void test() { 
    Failbot bot = new Failbot();
    //parameters for the event
    String name = "Bot";
    double energy = 100, bearing = 20, distance = 199;
    double heading = 0, velocity = 4;
    double test = 0;
    //make the event
    ScannedRobotEvent e = new ScannedRobotEvent(name,energy,bearing,distance,heading,velocity);
    //call getPow with the event
    test = bot.getPow(e);
    //check the high power conditions
    //opponent is close
    assertEquals(test,3,0);
    System.out.println("1 Passed");
    
    //opponent is on our flank
    e = new ScannedRobotEvent(name,energy,90,distance,heading,velocity);
    test = bot.getPow(e);
    assertEquals(test,3,0);
    System.out.println("2 Passed");
    
    //opponent is slow
    e = new ScannedRobotEvent(name,energy,bearing,distance,heading,1.0);
    test = bot.getPow(e);
    assertEquals(test,3,0);
    System.out.println("3 Passed");
    
    //test for a distant enemy, should return lower power
    e = new ScannedRobotEvent(name,energy,bearing,400,heading,velocity);
    test = bot.getPow(e);
    assertEquals(test,2,0.5);
  }

}
